package com.mdlib.helper.api;

import com.hn.plt.config.ClientConfig;
import com.mdlib.helper.api.network.RetrofitHelper;
import com.mdlib.helper.api.service.AccountApi;
import com.mdlib.helper.api.service.SpecialApi;
import com.mdlib.helper.api.service.UserApi;
import com.mdlib.helper.api.service.WXApi;

/**
 * Created by librabin on 16/11/19.
 */

public class DataManager {

    private static DataManager instance;

    private AccountApi mAccountApi;

    private WXApi mWXApi;

    private UserApi mUserApi;

    private SpecialApi mSpecialApi;


    public static DataManager getInstance() {
        if (instance == null) {
            instance = new DataManager();
        }
        return instance;
    }


    public AccountApi getAccountApi() {
        if (mAccountApi == null) {
            mAccountApi = RetrofitHelper.configRetrofit(AccountApi.class, ClientConfig.BASE_URL, false);
        }

        return mAccountApi;
    }

    public WXApi getWXApi() {
        if (mWXApi == null) {
            mWXApi = RetrofitHelper.configRetrofit(WXApi.class, WXApi.WXHost, false);
        }

        return mWXApi;
    }


    public UserApi getUserApi() {
        if (mUserApi == null) {
            mUserApi = RetrofitHelper.configRetrofit(UserApi.class, ClientConfig.BASE_URL, true);
        }

        return mUserApi;
    }


    public SpecialApi getSpecialApi() {
        if (mSpecialApi == null) {
            mSpecialApi = RetrofitHelper.configRetrofit(SpecialApi.class, ClientConfig.BASE_URL, false);
        }

        return mSpecialApi;
    }


}
